package lxh.groovy.basic;

import groovy.sql.Sql;

/*def gsql = Sql.newInstance("jdbc:mysql://127.0.0.1/gappdb", "root", "111111", "com.mysql.jdbc.Driver")
gsql.eachRow("select * from AUTHOR where name='Mike'") { println it.id+":"+it.name }
gsql.eachRow("select count(*) from AUTHOR"){println it[0]}
def author = gsql.dataSet("AUTHOR");

author.each
{
	println "${it.name}";
}*/

def gsqTeach = Sql.newInstance("jdbc:mysql://127.0.0.1/teachdb", "root", "000000", "com.mysql.jdbc.Driver")
def kqdms = "";
gsqTeach.eachRow("select DISTINCT substring(zkzh,1,4) kqdm  from ntce_131 order by zkzh") 
{ 
	//println it.kqdm;
	kqdms += it.kqdm+","
}
println kqdms;


